// 时间格式转换
export function momnetTime(date) {
	var now = new Date(parseInt(date)),
		y = now.getFullYear(),
		m = now.getMonth() + 1,
		d = now.getDate();
	let h = now.getHours()
	let min = now.getMinutes()
	let s = now.getSeconds()
	return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + " " + (h < 10 ? '0' + h : h) +
		":" + (min < 10 ? '0' + min : min) + ":" + (s < 10 ? '0' + s : s)
}

// 当前日期
export function datesTime(date) {
	let now = new Date(date)
	let y = now.getFullYear()
	let m = now.getMonth() + 1
	let d = now.getDate();
	return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
}

// 将时间转时间戳，用于时间段过期判断
export function countTime(time, dateTime) {
	dateTime = dateTime + ' '
	let day = new Date(dateTime).getTime()
	let arr = time.split(':')
	// 只取到前两个成员
	let str1 = arr[0]
	let str2 = arr[1]

	let sarr1 = str1.split('')
	let sarr2 = str2.split('')
	let sum1 = 0
	let sum2 = 0
	let sum = 0
	sum1 = (parseInt(sarr1[0]) * 10 + parseInt(sarr1[1])) * 60 * 60 * 1000
	sum2 = (parseInt(sarr2[0]) * 10 + parseInt(sarr2[1])) * 60 * 1000
	sum = sum1 + sum2 + day
	return sum
}

// 根据时间段获取时间戳
export function getChuo(time) {

	let arr = time.split(':')
	// 只取到前两个成员
	let str1 = arr[0]
	let str2 = arr[1]

	let sarr1 = str1.split('')
	let sarr2 = str2.split('')
	let sum1 = 0
	let sum2 = 0
	let sum = 0
	sum1 = (parseInt(sarr1[0]) * 10 + parseInt(sarr1[1])) * 60 * 60 * 1000
	sum2 = (parseInt(sarr2[0]) * 10 + parseInt(sarr2[1])) * 60 * 1000
	sum = sum1 + sum2
	return sum
}